//
//  MineShareTableViewCell.m
//  MJApp
//
//  Created by wangliang on 15/3/30.
//  Copyright (c) 2015年 wangliang. All rights reserved.
//

#import "MineShareTableViewCell.h"

@interface MineShareTableViewCell ()
@property (weak, nonatomic) IBOutlet UIImageView *sharePic;
@property (weak, nonatomic) IBOutlet UILabel *nameLabel;
@property (weak, nonatomic) IBOutlet UILabel *priceLabel;

@end

@implementation MineShareTableViewCell

+ (instancetype)initWithTableView:(UITableView *)tableView {
    
    static NSString *cellID = @"MineShareTableViewCell";
    MineShareTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
    if (cell == nil) {
        
        cell =  WL_XIB(@"MineShareTableViewCell");
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    cell.cellHigh = CGRectGetHeight(cell.frame);
    return cell;
    
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)setInfoDic:(NSDictionary *)infoDic {
    
    _infoDic = infoDic;
    NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"%@%@",kUrl,infoDic[@"image"]]];
    [self.sharePic sd_setImageWithURL:url];
    self.nameLabel.text = infoDic[@"name"];
    self.priceLabel.text = [NSString stringWithFormat:@"￥%@",infoDic[@"price_low"]];
    
}
- (IBAction)buy:(id)sender {
    
    if ([self.delegte respondsToSelector:@selector(homeCell:withInfo:)]) {
        
        [self.delegte homeCell:self withInfo:self.infoDic];
    }
}

@end
